forum

home / developersection / forums / can you please explain this thread working?

Can you please explain this Thread working?

Madam Walker 2024 14-Oct-2013

Heres the code about threads.....I don't know the difference between those 2 new() statements.


  Runnable r=new Runnable() {

    public void run() {
    System.out.print("Cat");
    }
    };
    Thread t=new Thread(r) {
    public void run() {
    System.out.println("Dog");
    }
    };
    t.start();



Output is Dog But why and how ?


Updated on 14-Oct-2013
Madam Walker

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By